package com.yinxin.sychornized;

import com.yinxin.util.ThreadUtil;

import java.util.ArrayList;
import java.util.Vector;

/**
 * @author yinxin
 * @Title:
 * @Package
 * @Description:
 * @date 2022/1/913:58
 */
public class UnsafeList {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        Vector<String> vector = new Vector<>();
        for (int i = 0; i < 10000; i++) {
            new Thread(()->{
                list.add(Thread.currentThread().getName());
                vector.add(Thread.currentThread().getName());
            }).start();
        }
        ThreadUtil.sleep(3000);
        System.out.println(list.size());
        System.out.println(vector.size());
    }
}
